﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace sXNAke
{
    public enum Axis
    {
        X, Y
    }
    class Animation
    {
        
        /// <summary>
        /// A name for the animation
        /// </summary>
        private String name;

        /// <summary>
        /// The time for one frames in milliseconds
        /// </summary>
        private float frameTime;

        /// <summary>
        /// The size of the frame in pixels
        /// </summary>
        private Vector2 frameSize;
        
        /// <summary>
        /// the index a of fram in X coordinate
        /// </summary>
        private int  frameX;

        /// <summary>
        /// the index of a frame in Y coordinate
        /// </summary>
        private int frameY; 

        /// <summary>
        /// the total of frames
        /// </summary>
        private int totalFrames;

        /// <summary>
        /// Which axis the animation will be played
        /// </summary>
        private Axis axis;

        /// <summary>
        /// This class represents the animation of a object
        /// </summary>
        /// <param name="name">The name of the animation</param>
        /// <param name="frameTime">The time for one frame in milliseconds</param>
        /// <param name="frameX">the number of the frame in x coordinate</param>
        /// <param name="frameY">the number of the frame in y coordinate</param>
        /// <param name="numFrames">How many frames the animation have</param>
        /// <param name="Axis">Which axis the animation will be played</param>
        public Animation(String name, Vector2 frameSize, float frameTime, int frameX, int frameY, int totalFrames, Axis axis)
        {
            this.name = name;
            this.frameSize = frameSize;
            this.frameX = frameX;
            this.frameY = frameY;
            this.totalFrames = totalFrames;
            this.frameTime = frameTime;
            this.axis = axis;
        }

        /// <summary>
        /// gets the frame size
        /// </summary>
        /// <returns>The frame size</returns>
        public Vector2 getFrameSize()
        {
            return frameSize;
        }

        public void setFrameSize(Vector2 frameSize)
        {
            this.frameSize = frameSize;
        }

        /// <summary>
        /// Get the time of one frame
        /// </summary>
        /// <returns>The frameTime</returns>        
        public float getFrameTime()
        {
            return this.frameTime;
        }

        /// <summary>
        /// sets the time for one frame
        /// </summary>
        /// <param name="t">A time</param>
        public void setFrameTime(float t)
        {
            this.frameTime = t;
        }

        /// <summary>
        /// gets the total of frames
        /// </summary>
        /// <returns>The total of frames</returns>
        public int getTotalFrames()
        {
            return this.totalFrames;
        }

        /// <summary>
        /// Sets the total of frames
        /// </summary>
        /// <param name="num">The total of frames</param>
        public void setTotalFrames(int num)
        {
            this.totalFrames = num;
        }

        /// <summary>
        /// Gets the number for Y frame in the spriteSheet
        /// </summary>
        /// <returns>The number for Y frame</returns>
        public int getFrameY()
        {
            return this.frameY;
        }

        /// <summary>
        /// Gets the number for X frame in the spriteSheet
        /// </summary>
        /// <returns>The number for X frame</returns>
        public int getFrameX()
        {
            return this.frameX;
        }

        /// <summary>
        /// get the axis of the animation
        /// </summary>
        /// <returns>the axis</returns>
        public Axis getAxis()
        {
            return axis;
        }

        /// <summary>
        /// Gets the name for this animation
        /// </summary>
        /// <returns>The name of animation</returns>
        public String getName()
        {
            return this.name;
        }
    }
}
